package com.goodsogood.union.auth.util;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;

import com.goodsogood.union.auth.aspect.LogAspectAtController;

/**
 * Created by dongguochao on 23/11/2016.
 */
public class SignUtil {

    public static String getPlateformDeviceInfo(Map<String, String> params, HttpServletRequest request){
        if(StringUtils.isEmpty(params.get("plateformDeviceType"))){
            return null;
        }
        if(StringUtils.isEmpty(params.get("plateformDeviceInfo"))){
            String info = request.getHeader("User-Agent");
            params.put("plateformDeviceInfo", info);
        }
        String deviceInfo = params.get("plateformDeviceInfo");
        if(StringUtils.isEmpty(deviceInfo)){
            return LogAspectAtController.getIpAddr(request);
        }
        return deviceInfo;
    }

}
